package strategy_pjs.Auth;

import Auth_Confirm.Confirm_Authority;
import Auth_Confirm.Yes_Confirm;
import Auth_Delete.Delete_Authority;
import Auth_Delete.Yes_Delete;
import Auth_View.View_Authority;
import Auth_View.Yes_View;
import Auth_Write.Write_Authority;
import Auth_Write.Yes_Write;

public abstract class Auth {
	
	// �ൿ�� �߻�ȭ�� �������̽� ������� 
	protected Write_Authority write_authority;   //  ���� ���� 
	protected View_Authority view_authority;     //  ���� ���� 
	protected Delete_Authority delete_authority; // ���� ����
	protected Confirm_Authority confirm_authority; // ���� ���� 
	
	protected Auth(){
		write_authority   = new Yes_Write(); 	//  
		view_authority    = new Yes_View();     //  
		delete_authority  = new Yes_Delete();   // 
		confirm_authority = new Yes_Confirm();  // 
	}
	
	
	// ���Ѽ��� �ൿ�� ����
	public void check_Write(){
		write_authority.Write();
	}
	public void check_View(){
		view_authority.View();
	}
	public void check_Delete(){
		delete_authority.Delete();
	}
	public void check_Confirm(){
		confirm_authority.Confirm();
	}
	
	public abstract void Auth_Check(); // ���� üũ 
	
	
	// ���� ���� ����
	public void setAuthorith(Object obj){
			
		if( obj.getClass().getName().split("\\.")[0].equals(write_authority.getClass().getName().split("\\.")[0]) )  {
			
			this.write_authority = (Write_Authority) obj;
			
		}else if( obj.getClass().getName().split("\\.")[0].equals(view_authority.getClass().getName().split("\\.")[0]) )  {
			
			this.view_authority = (View_Authority) obj;
			
		}else if( obj.getClass().getName().split("\\.")[0].equals(delete_authority.getClass().getName().split("\\.")[0]) )  {
			
			this.delete_authority = (Delete_Authority) obj;
			
		}else if( obj.getClass().getName().split("\\.")[0].equals(confirm_authority.getClass().getName().split("\\.")[0]) )  {
			
			this.confirm_authority = (Confirm_Authority) obj;
		}
	}
	
	/*public void Write(){// �۾��� ����
		System.out.println("���� ����� �� �ֽ��ϴ�.");
	}
	public void View(){ // ���� ����
		System.out.println("���� �� �� �ֽ��ϴ�. ");
	}
	public void Delete(){ // �������� 
		System.out.println("���� ������ �� �ֽ��ϴ�. ");
	}*/

	
}
